/*
 * VCRReplyAdapter.java
 *
 * Created on January 6, 2006, 9:22 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.mbari.vcr;

import org.mbari.util.IObserver;
import org.mbari.util.ObservableSupport;
import org.mbari.vcr.rs422.VCRUserbits;

/**
 *
 * @author brian
 */
public class VCRReplyAdapter implements IVCRReply {
    
    /**
	 * @uml.property  name="vcrError"
	 * @uml.associationEnd  
	 */
    protected IVCRError vcrError;
    /**
	 * @uml.property  name="vcrState"
	 * @uml.associationEnd  
	 */
    protected IVCRState vcrState;
    /**
	 * @uml.property  name="vcrTimecode"
	 * @uml.associationEnd  
	 */
    protected IVCRTimecode vcrTimecode;
    /**
	 * @uml.property  name="vcrUserbits"
	 * @uml.associationEnd  
	 */
    protected IVCRUserbits vcrUserbits;
    
    /**
	 * @uml.property  name="os"
	 * @uml.associationEnd  multiplicity="(1 1)"
	 */
    private ObservableSupport os = new ObservableSupport();
    
    /** Creates a new instance of VCRReplyAdapter */
    public VCRReplyAdapter() {
     
    }

    /**
	 * @return  the vcrError
	 * @uml.property  name="vcrError"
	 */
    public IVCRError getVcrError() {
        if (vcrError == null) {
            vcrError = new VCRErrorAdapter();
        }
        return vcrError;
    }

    /**
	 * @return  the vcrState
	 * @uml.property  name="vcrState"
	 */
    public IVCRState getVcrState() {
        if (vcrState == null) {
            vcrState = new VCRStateAdapter();
        }
        return vcrState;
    }

    /**
	 * @return  the vcrTimecode
	 * @uml.property  name="vcrTimecode"
	 */
    public IVCRTimecode getVcrTimecode() {
        if (vcrTimecode == null) {
            vcrTimecode = new VCRTimecodeAdapter();
        }
        return vcrTimecode;
    }

    /**
	 * @return  the vcrUserbits
	 * @uml.property  name="vcrUserbits"
	 */
    public IVCRUserbits getVcrUserbits() {
        if (vcrUserbits == null) {
            vcrUserbits = new VCRUserbits();
        }
        return vcrUserbits;
    }

    public boolean isStatusReply() {
        return false;
    }

    public boolean isTimecodeReply() {
        return false;
    }

    public boolean isUserbitsReply() {
        return false;
    }

    public void addObserver(IObserver observer) {
        os.add(observer);
    }

    public void removeAllObservers() {
        os.clear();
    }

    public void removeObserver(IObserver observer) {
        os.remove(observer);
    }

    public boolean isAck() {
        return false;
    }

    public boolean isNack() {
        return false;
    }
    
    /** Notifies all the observers of a chage of state */
    protected void notifyObservers() {
        os.notify(this, null);
    }
    
}
